package com.ruoyi.web.controller.boc;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.boc.domain.PhPerformanceRankingPC;
import com.ruoyi.boc.service.IPhPerformanceRankingPCService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 个人业绩排名Controller
 * 
 * @author ruoyi
 * @date 2024-12-28
 */
@RestController
@RequestMapping("/boc/performanceRankingPC")
public class PhPerformanceRankingPCController extends BaseController
{
    @Autowired
    private IPhPerformanceRankingPCService phPerformanceRankingPCService;

    /**
     * 查询个人业绩排名列表
     */
    @PreAuthorize("@ss.hasPermi('boc:performanceRankingPC:list')")
    @GetMapping("/list")
    public TableDataInfo list(PhPerformanceRankingPC phPerformanceRankingPC)
    {
        startPage();
        List<PhPerformanceRankingPC> list = phPerformanceRankingPCService.selectPhPerformanceRankingPCList(phPerformanceRankingPC);
        return getDataTable(list);
    }

    /**
     * 导出个人业绩排名列表
     */
    @PreAuthorize("@ss.hasPermi('boc:performanceRankingPC:export')")
    @Log(title = "个人业绩排名", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, PhPerformanceRankingPC phPerformanceRankingPC)
    {
        List<PhPerformanceRankingPC> list = phPerformanceRankingPCService.selectPhPerformanceRankingPCList(phPerformanceRankingPC);
        ExcelUtil<PhPerformanceRankingPC> util = new ExcelUtil<PhPerformanceRankingPC>(PhPerformanceRankingPC.class);
        util.exportExcel(response, list, "个人业绩排名数据");
    }

    /**
     * 获取个人业绩排名详细信息
     */
    @PreAuthorize("@ss.hasPermi('boc:performanceRankingPC:query')")
    @GetMapping(value = "/{dateId}")
    public AjaxResult getInfo(@PathVariable("dateId") String dateId)
    {
        return success(phPerformanceRankingPCService.selectPhPerformanceRankingPCByDateId(dateId));
    }

    /**
     * 新增个人业绩排名
     */
    @PreAuthorize("@ss.hasPermi('boc:performanceRankingPC:add')")
    @Log(title = "个人业绩排名", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody PhPerformanceRankingPC phPerformanceRankingPC)
    {
        return toAjax(phPerformanceRankingPCService.insertPhPerformanceRankingPC(phPerformanceRankingPC));
    }

    /**
     * 修改个人业绩排名
     */
    @PreAuthorize("@ss.hasPermi('boc:performanceRankingPC:edit')")
    @Log(title = "个人业绩排名", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody PhPerformanceRankingPC phPerformanceRankingPC)
    {
        return toAjax(phPerformanceRankingPCService.updatePhPerformanceRankingPC(phPerformanceRankingPC));
    }

    /**
     * 删除个人业绩排名
     */
    @PreAuthorize("@ss.hasPermi('boc:performanceRankingPC:remove')")
    @Log(title = "个人业绩排名", businessType = BusinessType.DELETE)
	@DeleteMapping("/{dateIds}")
    public AjaxResult remove(@PathVariable String[] dateIds)
    {
        return toAjax(phPerformanceRankingPCService.deletePhPerformanceRankingPCByDateIds(dateIds));
    }
}
